package src.main.CreationalPatterns.Builder;

public class Client {
    public static void main(String[] args) {
        try {
            // 构建战士角色（链式调用）
            GameCharacter warrior = new GameCharacter.Builder("泰拉", "战士")
                    .weapon("大剑")
                    .armor("板甲")
                    .skill("旋风斩")
                    .skill("盾击")
                    .build();
            warrior.display();

            // 构建法师角色
            GameCharacter mage = new GameCharacter.Builder("吉安娜", "法师")
                    .weapon("法杖")
                    .skill("火球术")
                    .skill("寒冰箭")
                    .build();
            mage.display();

            // 测试异常情况（战士装备法杖）
            // GameCharacter invalid = new GameCharacter.Builder("测试", "战士")
            //     .weapon("法杖")
            //     .build();

        } catch (IllegalArgumentException e) {
            System.err.println("角色创建失败: " + e.getMessage());
        }
    }
}
